package designPattern;

public class Singleton {
    private static Singleton singleton;
    private Singleton() {
    }

    public static synchronized Singleton getInstance() {
        if (singleton == null) {
            singleton = new Singleton();
        }
        return singleton;
    }

    public void showMes() {
        System.out.println(singleton);
        System.out.println("Get It!");
    }
}

class Single {
    public static void main(String[] args) {
        Singleton instance = Singleton.getInstance();
        Singleton instance2 = Singleton.getInstance();
        instance.showMes();
        instance2.showMes();
    }
}
